package com.cat.intrepreter;

/**
 * @author cat
 * @version 2025/5/28 16:51
 * @description 减法表达式类
 * @since JDK17
 */

public class Minus extends AbstractExpression {
    // 左边的表达式
    private AbstractExpression left;
    // 右边的表达式
    private AbstractExpression right;

    public Minus(AbstractExpression left, AbstractExpression right) {
        this.left = left;
        this.right = right;
    }
    @Override
    public int interpret(Context context) {
        return left.interpret(context) - right.interpret(context);
    }

    @Override
    public String toString() {
        return "Plus{" +
                "left=" + left +
                ", right=" + right +
                '}';
    }
}
